package edu.ncst.baseweb.controller.equ;

import cn.wintersun.basecommon.common.Result;
import edu.ncst.baseweb.dao.equ.Equ;
import edu.ncst.baseweb.service.intrer.equ.EquScrapService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

//设备报废管理
@RestController
@RequestMapping("admin/equipment/scrap")
@PreAuthorize("hasAuthority('3')")
public class EquScrapController {
    @Autowired private EquScrapService equScrapService;
    //列表
    @RequestMapping(value = "list",method = RequestMethod.POST)
    public Result<IPage<Equ>> list(@RequestBody Equ equ){

        return  equScrapService.list(equ);
    }
    @RequestMapping(value = "delete",method = RequestMethod.POST)
    public Result<Object> delete(@RequestBody String equId){
        try {
            return equScrapService.delete(equId);
        } catch (Exception e) {
            return Result.failure(500, e.getMessage());
        }
    }

}
